﻿using System;

namespace Mozi.Live.SDP
{
    /// <summary>
    /// 时间区间 时间戳格式
    /// </summary>
    public class SDPTimeActive
    {
        //2208988800
        //1900-01-01
        /// <summary>
        /// 开始时间
        /// </summary>
        public ulong StartTime { get; set; }
        /// <summary>
        /// 结束时间
        /// </summary>
        public ulong StopTime { get; set; }
        /// <summary>
        /// 解析时间区间
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        public static SDPTimeActive Parse(string value)
        {
            SDPTimeActive rt = new SDPTimeActive();
            string[] items = value.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            rt.StartTime = ulong.Parse(items[0]);
            rt.StopTime = ulong.Parse(items[1]);
            return rt;
        }

        public override string ToString()
        {
            return $"{StartTime} {StopTime}";
        }
    }

}
